import { baseURL } from "@/utils/request"
import $ from "jquery";
export function validatePhone(phone) {
    const regExp = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/
    if (!regExp.test(phone)) {
        return false;
    } else {
        return true;
    }
}

// 替换base地址
export function commonImageUrl(url) {
    if (url.indexOf(baseURL) != -1) {
        return url;
    } else {
        return baseURL + url;
    }
}

// 订单列表jquery代码
export function orderMenu() {
    $("#ddorder .operate_more").click(function () {
        if ($(this).parents(".operate_delete").hasClass("on")) {
          $(this).next(".operate_more .gdxx").slideUp();
          $(this).parents(".operate_delete").removeClass("on");
        } else {
          $("#ddorder .operate_more .gdxx").slideUp();
          $(this).next(".operate_more .gdxx").slideDown();
          $("#ddorder .operate_more").removeClass("on");
          $(this).parents(".operate_delete").addClass("on");
        }
    });
}